import {
  attachNewStation,
  getNewStation,
} from '@/components/MapView/Mapless/mana/newstation';
import {
  attachOldStation,
  getOldStation,
} from '@/components/MapView/Mapless/mana/oldstation';

const getStationFuncs: {
  [key: string]: typeof getNewStation | typeof getOldStation;
} = {
  getStation: getOldStation,
  getOldStation: getOldStation,
  getNewStation: getNewStation,
};

export const getFunc = (prefix: string) => {
  const name = `get${prefix}Station`;
  return getStationFuncs[name] || getStationFuncs.getStation;
};

const useStationFuncs: {
  [key: string]: typeof attachNewStation | typeof attachOldStation;
} = {
  useStation: attachOldStation,
  useOldStation: attachOldStation,
  useNewStation: attachNewStation,
};

export const attachFunc = (prefix: string) => {
  const name = `use${prefix}Station`;
  return useStationFuncs[name] || useStationFuncs.useStation;
};
